﻿<UserControl x:Class="Emcc.TeamSystem.TaskBoard.UIElements.ViewEditorControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="350" Width="500"
    Name="ViewEditPanel">
	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="Resources/ApplicationStyles.xaml"/>
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</UserControl.Resources>
    <Border Padding="10" BorderBrush="Black" BorderThickness="2" Background="{DynamicResource MainBackground}">
        <DockPanel>
            <StackPanel  DockPanel.Dock="Top" Style="{DynamicResource CommandPanel}">
        		<Button Click="Delete_Click" Style="{DynamicResource CommandButton}">
        			<StackPanel Orientation="Horizontal">
        				<Image Width="16" Height="16" Source="Images/placeholder.png" Stretch="Fill"/>
        				<TextBlock Margin="2,0,2,0"><Run Text="Delete"/></TextBlock>
        			</StackPanel>
        		</Button>
        		<Button Click="Close_Click" Style="{DynamicResource CommandButton}">
        			<StackPanel Orientation="Horizontal">
        				<Image Width="16" Height="16" Source="Images/placeholder.png" Stretch="Fill"/>
        				<TextBlock Margin="2,0,2,0"><Run Text="Close"/></TextBlock>
        			</StackPanel>
        		</Button>
        	</StackPanel>
            <TextBlock DockPanel.Dock="Top" TextBlock.FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" TextBlock.FontSize="16">View Editor Panel</TextBlock>
            <TabControl DockPanel.Dock="Top" Background="{DynamicResource ListControlBackground}">
                <TabItem Header="General">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        
                        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Title:</TextBlock>
                        <TextBox Grid.Column="1" Margin="2" Text="{Binding ElementName=ViewEditPanel, Path=View.ViewMap.Title, UpdateSourceTrigger=PropertyChanged}" Background="White" />

                        <TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">Description:</TextBlock>
                        <TextBox Grid.Row="1" Margin="2" Grid.Column="1" Text="{Binding ElementName=ViewEditPanel, Path=View.ViewMap.Description, UpdateSourceTrigger=PropertyChanged}" />

                        <TextBlock Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">Row Type:</TextBlock>
                        <ComboBox
                            Name="ParentType"
                            Margin="2"
                            Grid.Row="2" 
                            Grid.Column="1" 
                            ItemsSource="{Binding ElementName=ViewEditPanel, Path=ProjectData.ItemTypes.Keys}"
                            SelectedItem="{Binding ElementName=ViewEditPanel, Path=View.ViewMap.ParentType}" 
                            SelectionChanged="ParentType_SelectionChanged"
                            />

                        <TextBlock Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center">Link Type:</TextBlock>
                        <ComboBox
                            Name="LinkType"
                            Margin="2"
                            Grid.Row="3" 
                            Grid.Column="1" 
                            ItemsSource="{Binding ElementName=ViewEditPanel, Path=ProjectData.LinkTypes}"
                            SelectedItem="{Binding ElementName=ViewEditPanel, Path=View.ViewMap.LinkName}" 
                            />
                        
                        <TextBlock Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center">Child Type:</TextBlock>
                        <ComboBox 
                            Name="ChildType"
                            Margin="2"
                            Grid.Row="4" 
                            Grid.Column="1" 
                            ItemsSource="{Binding ElementName=ViewEditPanel, Path=ProjectData.ItemTypes.Keys}"
                            SelectedItem="{Binding ElementName=ViewEditPanel, Path=View.ViewMap.ChildType}" 
                            SelectionChanged="ChildType_SelectionChanged"
                            />

                    </Grid>
                </TabItem>
                <TabItem Header="Child States">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="0.35*" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <DockPanel Grid.Row="0" Grid.RowSpan="2">
                            <TextBlock DockPanel.Dock="Top" HorizontalAlignment="Center">Unassigned States</TextBlock>
                            <ListBox Name="UnassignedStates" Background="White" />
                        </DockPanel>

                        <StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
                            <Button Margin="10,5,10,5" Click="ToSwimLane_Click">&gt;&gt;</Button>
                            <Button Margin="10,5,10,5" Click="FromSwimLine_Click">&lt;&lt;</Button>
                        </StackPanel>

                        <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
                            <Button Margin="10,5,10,5" Click="ToBucket_Click">&gt;&gt;</Button>
                            <Button Margin="10,5,10,5" Click="FromBucket_Click">&lt;&lt;</Button>
                        </StackPanel>

                        <DockPanel Grid.Row="0" Grid.Column="2">
                            <TextBlock DockPanel.Dock="Top" HorizontalAlignment="Center">Swim Lanes</TextBlock>
                            <ListBox Name="SwimLaneStates" Background="White" />
                        </DockPanel>

                        <DockPanel Grid.Row="1" Grid.Column="2">
                            <TextBlock DockPanel.Dock="Top" HorizontalAlignment="Center">Bucket States</TextBlock>
                            <ListBox Name="BucketStates" Background="White" />
                        </DockPanel>
                    </Grid>
                </TabItem>
            </TabControl>
        </DockPanel>
    </Border>
</UserControl>
